function parsePath(path, result) {
  var next = tokenizer(path);
  var arrayNotation = false;

  while (true) {
    var token = next();
    if (arrayNotation) {
      if (token.type != "string") {
        return false;
      }
      result.push(token.value);
      token = next();
      if (token.type != "punc" || token.value != "]") {
        return false;
      }
    } else if (token.type == "name") {
      result.push(token.value);
    } else {
      return false;
    }
    
    token = next();
    if (token.type == "eof") {
      return true;
    }
    if (token.type != "punc" || (token.value != "." && token.value != "[")) {
      return false;
    } else {
      arrayNotation = token.value == "[";
    }
  }
}
